import request from '@/utils/request'
import type { ApiRes } from '@/types/data'
import type { SwiperQuery, Swiper } from '@/types/swiper'

export const getSwierList = (params: SwiperQuery) => {
  return request<ApiRes<{ total: number; items: Swiper[] }>>({
    url: 'banner/list',
    params
  })
}

// 新增轮播图
export const addSwiper = (data: Swiper) => {
  return request({
    url: 'banner/add',
    method: 'POST',
    data
  })
}

// 修改轮播图
export const updateSwiper = (data: Swiper) => {
  return request({
    url: 'banner/update',
    method: 'POST',
    data
  })
}

// 删除轮播图
export const deleteSwiper = (bannerid: string) => {
  return request({
    url: `banner/delete/${bannerid}`,
    method: 'DELETE'
  })
}
